/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package wisimconsole;

import java.awt.Color;
import java.awt.FlowLayout;
import java.util.ArrayList;
import java.util.concurrent.TimeUnit;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JDesktopPane;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JRootPane;
import javax.swing.UIManager;
import javax.swing.UnsupportedLookAndFeelException;
import org.graphstream.ui.swingViewer.View;
import org.graphstream.ui.swingViewer.Viewer;
import wiBase.WiException;
import wiBase.WiObject;
import wiBase.baseInterface.OnDrawerListener;
import wiBase.baseObject.Node;

/**
 *
 * @author brother
 */
public class TestSplitePane extends javax.swing.JFrame implements OnDrawerListener{

    /**
     * Creates new form TestSplitePane
     */
    public TestSplitePane() {
	try {
	    initComponents();
	    
	    wiEngine.WiEngine engine=wiEngine.WiEngine.getInstance();
	    engine.setTraceFile("C:\\Users\\brother\\Desktop\\trace.tr");
	    engine.setStartTime(-1);
	    engine.setEndTime(-1);
	    engine.setSpeed(1D, TimeUnit.NANOSECONDS);
	    engine.addOnDrawerListener(this);
	    engine.parse();
	    engine.run();
	    
    //	// add a viewer
    //	WiGraph graph=new WiGraph("mygraph");
    //	for(int i=0;i<10;++i){
    //	    graph.addNode(i+"");
    //	}
    //	Viewer viewer=new Viewer(graph, Viewer.ThreadingModel.GRAPH_IN_ANOTHER_THREAD);
    //	View v=viewer.addDefaultView(false);
    ////	this.setContentPane(v);
    //	JRootPane root=this.getRootPane();
    ////	root.setContentPane(v);
    //	mypanel.add(v);
    //	this.setContentPane(mypanel);
    //	this.setContentPane(mypanel);
	} catch (WiException ex) {
	    Logger.getLogger(TestSplitePane.class.getName()).log(Level.SEVERE, null, ex);
	}
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        panel = new javax.swing.JPanel();
        mypanel = new javax.swing.JPanel();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

        mypanel.setLayout(new java.awt.BorderLayout());

        javax.swing.GroupLayout panelLayout = new javax.swing.GroupLayout(panel);
        panel.setLayout(panelLayout);
        panelLayout.setHorizontalGroup(
            panelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(mypanel, javax.swing.GroupLayout.DEFAULT_SIZE, 556, Short.MAX_VALUE)
        );
        panelLayout.setVerticalGroup(
            panelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(mypanel, javax.swing.GroupLayout.DEFAULT_SIZE, 473, Short.MAX_VALUE)
        );

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(panel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(panel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
	/* Set the Nimbus look and feel */
	//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
	 * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
	 */
	try {
	    for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
		if ("Nimbus".equals(info.getName())) {
		    javax.swing.UIManager.setLookAndFeel(info.getClassName());
		    break;
		}
	    }
	} catch (ClassNotFoundException ex) {
	    java.util.logging.Logger.getLogger(TestSplitePane.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
	} catch (InstantiationException ex) {
	    java.util.logging.Logger.getLogger(TestSplitePane.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
	} catch (IllegalAccessException ex) {
	    java.util.logging.Logger.getLogger(TestSplitePane.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
	} catch (javax.swing.UnsupportedLookAndFeelException ex) {
	    java.util.logging.Logger.getLogger(TestSplitePane.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
	}
	//</editor-fold>
	try {
	    UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
	    //UIManager.setLookAndFeel("javax.swing.plaf.nimbus.NimbusLookAndFeel");
	} catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException ex) {
	}
	/* Create and display the form */
	java.awt.EventQueue.invokeLater(new Runnable() {
	    
	    public void run() {
		new TestSplitePane().setVisible(true);
	    }
	});
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JPanel mypanel;
    private javax.swing.JPanel panel;
    // End of variables declaration//GEN-END:variables

    @Override
    public void updateState(WiObject object) {
	System.out.println(object.toString());
    }

    @Override
    public void DrawNodes(ArrayList<Node> nodes) {
	throw new UnsupportedOperationException("Not supported yet.");
    }

    @Override
    public void Start() throws Exception {
	throw new UnsupportedOperationException("Not supported yet.");
    }
}
